#include<bits/stdc++.h>
#define int long long
#define N 100005
using namespace std;
int n,m;
int len,p[N],h[N];
int ans[N];
char s[N],t[N];
int f[2005][2005],g[2005][2005];
int F[N][22],G[N][22];
void sol(int x,int y){
    if(!y) return;
    sol(g[x][y],y-1);
    printf("%lld ",x);
}
void sol2(int x,int y){
    if(!y) return;
    sol2(G[x][y],y-1);
    printf("%lld ",x);
}
void sub(){
    f[0][0]=1;
    for(int i=1;i<=n;i++){
        f[i][0]=1;
        if(s[i]!=s[1]) break;
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i]!=t[j]) continue;
            if(t[j]!=t[j-1]){
                if(f[p[h[i]]-1][j-1]) f[i][j]=1,g[i][j]=p[h[i]]-1;
                if(p[h[i]]==i&&f[p[h[i]-1]][j-1]) f[i][j]=1,g[i][j]=p[h[i]-1];
            }
            else{
                if(p[h[i]]!=i&&f[i-1][j-1]) f[i][j]=1,g[i][j]=i-1;
                if(p[h[i]]==i&&h[i]>1&&f[p[h[i]-1]-1][j-1]) f[i][j]=1,g[i][j]=p[h[i]-1]-1;
            }
        }
    }
    for(int i=n;i>=1;i--){
        if(f[i][m]){printf("YES\n");sol(i,m);return;}
        if(s[i]!=s[n]) break;
    }
    printf("NO\n");
}
void sub2(){
    p[len+1]=n+1;
    if(s[1]==t[1]){
        if(m==len||m==len-1){
            printf("YES\n");
            for(int i=1;i<=m;i++) printf("%lld ",p[i+1]-1);
        }
        else printf("NO\n");
    }
    else{
        if(m==len-1){
            for(int i=1;i<=m;i++) printf("%lld ",p[i+1]);
        }
        else printf("NO\n");
    }
}
signed main(){
    freopen("seq.in","r",stdin);
    freopen("seq.out","w",stdout);
    scanf("%s",s+1);n=strlen(s+1);
    scanf("%s",t+1);m=strlen(t+1);
    for(int i=1;i<=n;i++){
        if(i==1||s[i]!=s[i-1]) p[++len]=i;
        h[i]=len;
    }
    if(n<=2000&&m<=2000){sub();return 0;}
    int o=0;
    for(int i=2;i<=m;i++) if(t[i]!=t[i-1]) o++;
    if(o==m-1){sub2();return 0;}
    F[0][0]=1;
    for(int i=1;i<=n;i++){
        F[i][0]=1;
        if(s[i]!=s[1]) break;
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i]!=t[j]) continue;
            if(t[j]!=t[j-1]){
                if(F[p[h[i]]-1][j-1]) F[i][j]=1,G[i][j]=p[h[i]]-1;
                if(p[h[i]]==i&&F[p[h[i]-1]][j-1]) F[i][j]=1,G[i][j]=p[h[i]-1];
            }
            else{
                if(p[h[i]]!=i&&F[i-1][j-1]) F[i][j]=1,G[i][j]=i-1;
                if(p[h[i]]==i&&h[i]>1&&F[p[h[i]-1]-1][j-1]) F[i][j]=1,G[i][j]=p[h[i]-1]-1;
            }
        }
    }
    for(int i=n;i>=1;i--){
        if(F[i][m]){printf("YES\n");sol2(i,m);return 0;}
        if(s[i]!=s[n]) break;
    }
    printf("NO\n");
    return 0;
}